﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CP2011_Assignment
{
    public partial class MenuProductionUI : Form
    {
        public MenuProductionUI()
        {
            InitializeComponent();
        }

        private void btnLogout_Click(object sender, EventArgs e)
        {
            
          
                this.Hide();
                Login login = new Login();
                DialogResult dr = login.ShowDialog();
                this.Dispose();
            
        }

        private void MenuProduction_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to exit?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (result == DialogResult.Yes)
            {
                this.Hide();
               
                this.Dispose();
            }
            else
            {
                e.Cancel = true;
            }
        }

        private void btnCreateProduct_Click(object sender, EventArgs e)
        {
            this.Hide();
            CreateProductUI createProd = new CreateProductUI();
            createProd.Owner = this;
            createProd.Show();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            this.Hide();
            DeleteProductUI deleteProd = new DeleteProductUI();
            deleteProd.Owner = this;
            deleteProd.Show();

        }

        private void simulation_Click(object sender, EventArgs e)
        {
            ProductionSystem prodsystem = new ProductionSystem();
            prodsystem.consumeItem();
            this.Hide();
            MenuProductionUI menuUi = new MenuProductionUI();
            DialogResult dr = menuUi.ShowDialog();
            this.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            EditProductUI editProd = new EditProductUI();
            editProd.Owner = this;
            editProd.Show();
        }

    }
}
